<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    var numIdenticalPairs = function(nums) {
      let ret = 0, i, j, len = nums.length
      for(i = 0; i < len; i++) {
        for(j = i + 1; j < len; j++) {
          if (nums[i] === nums[j]) {
            ret ++
          }
        }
      }
      return ret
    };
    let ret = numIdenticalPairs([1,2,3,1,1,3])
    console.log(ret);
  </script>
</body>
</html>